home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
ab20
/
ab20_archive
/
languages
/
assembly
/
powervisor_113.lzh
/
docs
/
ExtractIndex.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1991-09-10
|
2KB
|
131 lines
/* This ARexx script extracts an index file made by 'MakeIndex' */
parse arg fn
idxfnin='t:'||fn||'.tmp'
confnin='t:'||fn||'.tmpc'
idxfnout=fn||'.idx'
confnout=fn||'.contents'
rc=open(o,"console:",'w')
rc=open(idxin,idxfnin,'r')
if rc=0 then do
say
say 'Error opening file' idxfnin '!'
exit
end
rc=open(conin,confnin,'r')
if rc=0 then do
say
say 'Error opening file' confnin'!'
rc=close(idxin)
exit
end
rc=open(idxout,idxfnout,'w')
if rc=0 then do
say
say 'Error opening file for writing' idxfnout '!'
rc=close(idxin)
rc=close(conin)
exit
end
rc=open(conout,confnout,'w')
if rc=0 then do
say
say 'Error opening file for writing' confnout '!'
rc=close(idxout)
rc=close(idxin)
rc=close(conin)
exit
end
/*------------*/
/* Make index */
/*------------*/
index=0
writech(o,' [index:')
writeln(idxout,' Index for' fn)
do while eof(idxin)=0
lin=readln(idxin)
parse var lin linenr ':' after
call writeindexes('¹ 1')
call writeindexes('² 2')
call writeindexes('³ 3')
end
writech(o,index||']')
/*---------------*/
/* Make contents */
/*---------------*/
contents=0
writech(o,' [contents:')
writeln(conout,' Contents for' fn)
do while eof(conin)=0
lin=readln(conin)
parse var lin linenr ':' after
after=strip(after,'B','=')
after=strip(after,'B',' ')
olin=left(after||' ',40,'-') fn ':' linenr
writeln(conout,olin)
contents=contents+1
end
say contents||']'
/*------------------*/
/* Close everything */
/*------------------*/
rc=close(idxin)
rc=close(conin)
address command 'delete quiet' idxfnin
address command 'delete quiet' confnin
rc=close(idxout)
rc=close(conout)
rc=close(o)
exit
/*--------------------------------------------------------*/
/* Subroutine to write all indexes for one line to a file */
/*--------------------------------------------------------*/
writeindexes: procedure expose index idxout fn after linenr
parse arg isym inum
inum=strip(inum,'B',' ')
parse var after before (isym) rest
rlinenr=linenr
do while rest~=''
if substr(rest,1,1)=isym then do
rest=substr(rest,2)
rlinenr=rlinenr||'!'
end
word=strip(subword(rest,1,inum),'T','.')
word=strip(word,'T',',')
word=strip(word,'T',')')
olin=left(word||' ',40,'-') left(fn,22) ':' rlinenr
writeln(idxout,olin)
index=index+1
parse var rest before (isym) rest
rlinenr=linenr
end
return